﻿using UnityEngine;
using System.Collections;

public class EnemyCreatrt : MonoBehaviour {
	public GameObject[] enemyPrefabs;
	// Use this for initialization
	public float creatlnterval=2f;

	void Start () {
	
		InvokeRepeating ("CreatOne", 0, creatlnterval);
	}
	
	// Update is called once per frame
	void CreatOne ()
	{ 
		int indx = Random.Range (0, enemyPrefabs.Length);
		GameObject prefab = enemyPrefabs [indx];
		Vector3 pos = new Vector3 (Random.Range (-2.5f, 2.5f), 5.5f);
		Instantiate (prefab, pos, Quaternion.identity);
	
	}
}
